Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Conversation

@jsherlockppb
Copy link

Hi,

Here's a PR for your consideration, which allows users to specify additional keycodes which trigger adding a tag based on the current input value. Currently, this only happens with the user presses Enter (13), but this change allows users to specify an optional array of additionalKeycodes which can result in a tag being added e.g. comma, space, tab etc.

I have updated example/index.tsx accordingly to illustrate how this would work. The new property is optional and so has no impact on the current functionality if it is not provided.

const initialSettings: ReactTagInputProps = {
  tags: [],
  onChange: (tags) => {},
  placeholder: "Type and press enter, tab, space or comma",
  maxTags: 10,
  editable: true,
  readOnly: false,
  removeOnBackspace: true,
  validator: undefined,
  additionalKeycodes: [9, 32, 188]  // tab, space, comma
};

Thanks,

J

@jsherlockppb
Copy link
Author

Ah, I've just spotted there is another PR open which provides similar functionality. Please consider merging that. I'll close this one now. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant